import http from "@/plugins/aixos";

export function findAllLine(args: Record<string, any>) {
  const url =
    "/line?" +
    Object.entries(args)
      .map(([key, value]) => `${key}=${value}`)
      .join("&");
  return http.request<LineDataInter[]>({
    url,
    method: "GET",
  });
}

export function addLine(data: LineDataInter) {
  return http.request<LineDataInter>({
    url: "/line",
    method: "POST",
    data,
  });
}

export function updateLine(id: number, data: LineDataInter) {
  return http.request({
    url: `/line/${id}`,
    method: "PATCH",
    data,
  });
}

export function delLine(id: number) {
  return http.request({
    url: `/line/${id}`,
    method: "DELETE",
  });
}

export function findLine(id: number) {
  return http.request<LineDataInter>({
    url: `/line/${id}`,
    method: "GET",
  });
}
